package com.key.oa.util;

public class ServerData {

	/*
	 * Here we just use String to save the result.
	 * In the other place we need to change it.
	 * */
	private String ip = "116.228.31.168";  //just like "192.168.0.1"
	
	private String port = "10001";
	
	private String uri = "";
	
	private String oa = "ApmServers.ashx";
	
	public void setOA( String oa ) {
		this.oa = oa;
	}
	
	public String getOA() {
		return oa;
	}
	
	public String getUriLogin() {
		return ("http://" + ip + ":" + port + "/" + oa + "?flag=login");
	}
	
	public String getUriUnchecked() {
		return ("http://" + ip + ":" + port + "/" + oa + "?flag=unchecked");
	}
	
	public String getUriPass( String str,int pos ) {
		if( str.length() != 0 ) {
			return ("http://" + ip + ":" + port + "/" + oa + "?flag=pass&Comment=" + str + 
					"&Id=" + Util.uncheckdata.get(pos).getUnchecked("Id") +
					"&StartUserId=" + Util.uncheckdata.get(pos).getUnchecked("StartUserId") +
					"&Cost_ISGDZC=" + Util.uncheckdata.get(pos).getUnchecked("Cost_ISGDZC") +
					"&StepName=" + Util.uncheckdata.get(pos).getUnchecked("StepName") );
		}
		return ("http://" + ip + ":" + port + "/" + oa + "?flag=pass&Id=" +
					Util.uncheckdata.get(pos).getUnchecked("Id") +
					"&StartUserId=" + Util.uncheckdata.get(pos).getUnchecked("StartUserId") +
					"&Cost_ISGDZC=" + Util.uncheckdata.get(pos).getUnchecked("Cost_ISGDZC") +
					"&StepName=" + Util.uncheckdata.get(pos).getUnchecked("StepName") );
	}
	
	public String getUriUnpass( String str,int pos ) {
		if( str.length() != 0 ) {
			return ("http://" + ip + ":" + port + "/" + oa + "?flag=unpass&Comment=" + str + 
					"&Id=" + Util.uncheckdata.get(pos).getUnchecked("Id") +
					"&StartUserId=" + Util.uncheckdata.get(pos).getUnchecked("StartUserId") +
					"&Cost_ISGDZC=" + Util.uncheckdata.get(pos).getUnchecked("Cost_ISGDZC") +
					"&StepName=" + Util.uncheckdata.get(pos).getUnchecked("StepName") );
		}
		return ("http://" + ip + ":" + port + "/" + oa + "?flag=unpass&Id=" +
					Util.uncheckdata.get(pos).getUnchecked("Id") +
					"&StartUserId=" + Util.uncheckdata.get(pos).getUnchecked("StartUserId") +
					"&Cost_ISGDZC=" + Util.uncheckdata.get(pos).getUnchecked("Cost_ISGDZC") +
					"&StepName=" + Util.uncheckdata.get(pos).getUnchecked("StepName") );
	}
	
	public String getURI() {
		return uri;
	}
	
	public void setIP( String ip ) {
		this.ip = ip;
	}
	
	public void setPort( String port ) {
		this.port = port;
	}
	
	public String getIP() {
		return ip;
	}
	
	public String getPort() {
		return port;
	}
	
}
